﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<fmt:setBundle basename="ApplicationMessage" />


<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>

</head>

<body class="ihg-theme-draft">

  <%@ include file="/WEB-INF/include/header.jsp"%>
  <%@ include file="/WEB-INF/include/submenu.jsp"%>

  <div class="container-fluid ihg-container has-ihg-sidemenu">

    <div class="ihg-breadcrumb">
      <ol class="breadcrumb border-breadcrumb">
        <li class="active">Session Mgnt</li>
      </ol>
    </div>

    <div class="ihg-content-layout" style="margin-top: 10px;">
    
      <div class="ihg-operation-bar no-margin no-bottom-border clearfix">
        <div class="ihg-operation-group pull-right">
          <a href="${ctx.host}/active-sessions/report-data-export" class="btn btn-success btn-shadow btn-shadow-success">Report Data</a>
        </div>
      </div>
      
      <table class="table table-striped ihg-table tab-pane" style="margin-top: 15px;">
        <thead>
          <tr>
            <th>NAME</th>
            <th>ASSESSOR</th>
            <th>DELEGATE</th>
            <th>DATE</th>
            <th>ADMINISTRATOR</th>
            <th>PHASE</th>
            <th class="text-center">OPT</th>
          </tr>
        </thead>
        
        <tbody>
          <c:forEach var="session" items="${sessions}">
            <tr>
              <td>${session.name}</td>
              <td>${session.assessorCount}</td>
              <td>${session.delegateCount}</td>
              <td><fmt:formatDate value="${session.startDate}" pattern="yyyy-MM-dd"/>&nbsp;-&nbsp;<fmt:formatDate value="${session.endDate}" pattern="yyyy-MM-dd"/></td>
              <td>
                <p style="text-align:left;">Administrator: ${session.sessionHost.name}</p>
                <p style="text-align:left;">Assessor Owner:&nbsp;${session.assessorOwner.name}</p>
                <p style="text-align:left;">Delegate Owner:&nbsp;${session.delegateOwner.name}</p>
              </td>
              <td>
                <label class="label label-${session.sessionPhase.css}">${session.sessionPhase.display}</label>
              </td>
              
              <td class="text-center">
              
                <c:if test="${session.sessionPhase.before}">
                  <a href="${ctx.host}/sessions/${session.id}/preparation-home">View</a>
                </c:if>
                
                <c:if test="${session.sessionPhase.during}">
                  <a href="${ctx.host}/sessions/${session.id}/day-one-summary">View</a>
                </c:if>
                
                <c:if test="${session.sessionPhase.after}">
                  <a href="${ctx.host}/active-sessions/${session.id}/close" data-target="#close" data-toggle="modal">Close</a>&nbsp;&nbsp;
                  <a href="${ctx.host}/sessions/${session.id}/final-reports">View</a>
                </c:if>
                
              </td>
            </tr>
          </c:forEach>
        </tbody>
      </table>
    </div>

  </div>

  <%@ include file="/WEB-INF/include/footer.jsp"%>
  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource root="${ctx.resource}/build" type="script" src="js/page/session/session-list.js" />
  <script type="text/javascript">
    require([ 'page/session/session-list' ], function(page) {
      page.init();
    })
  </script>
  
</body>
</html>